package com.example.demo.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.example.demo.entity.Demo;
import com.example.demo.service.IDemoService;

/**
 * DemoService接口实现类
 * @author zy
 *
 */
@Service(value = "demoService")
public class DemoServiceImpl implements IDemoService {
	//@Resource
	//private DemoDao demoDao;
	
	//此处仅是方便测试
	private Map<Integer,Demo> demos = new HashMap<Integer,Demo>();

	@Override
	public Demo get(Integer id) {
		//return demoDao.get(id);
		return (Demo) demos.get(id);
	}
	@Override
	public Demo save(Demo demo) {
		//Demo demo = BeanUtils.getCopyObject(demoCo, Demo.class);
		//demoDao.save(demo);
		demos.put(demo.getId(), demo);
		return demo;
	}

}
